<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="css/handerAndFooter.css">
    <link rel="stylesheet" type="text/css" href="css/admin.css">
    <link rel="stylesheet" type="text/css" href="css/shoppingindex.css">
    <style>
        .el-tabs__item {
            margin-bottom: 30px;
        }

        .el-tabs__active-bar {
            background-color: #E4E7ED;
        }

        .el-dropdown-link {
            cursor: pointer;
            color: #409EFF;
        }

        .el-row {
            margin-bottom: 20px;
        }

        .el-col {
            border-radius: 4px;
        }

        .bg-purple-light {
            background: #e5e9f2;
        }

        .grid-content {
            border-radius: 4px;
            min-height: 36px;
            text-align: center;
            font-size: 16px;
        }

        .row-bg {
            padding: 10px 0;
            background-color: #f9fafc;
        }

    </style>
</head>
<body>
<!--***************头部********************-->
<div>
    <el-container>
        <el-header style="padding: 0;height:90px;background-color: rgb(0, 149, 215); ">
            <!--            <div id="header-navbar"> 地平线8号 尽管出发 创造不凡</div>-->
            <!--            &lt;!&ndash;        ************************************&ndash;&gt;-->
            <div class="header222"
                 style="overflow:hidden;margin: 0 auto;padding-top:15px;width: 80%;    ">
                <div style="float: left ;
                     vertical-align: bottom;
                     padding-left: 20px;
                    margin-left: 3%;">
                    <h1 style="font-size: 35px;color: white">Level8 商城 后台管理系统</h1>
                    <!--        <el-menu-item index="3" disabled>消息中心</el-menu-item>-->
                    </el-menu>
                    <div class="line" style=""></div>

                </div>
                <div>
                    <a href="" style="margin-top: 20px;font-size: 15px;float: right;color: white">登录</a>
                </div>
                <div style="float: right;width: 50px;margin-top: 10px">
                    <img src="./img/people.png" class="iconimg1" style="width: 70%">
                </div>
            </div>
        </el-header>
        <el-main>
            <el-tabs :tab-position="tabPosition" style=" margin-top: 20px">
                <el-tab-pane label="商品列表">

                </el-tab-pane>
                <el-tab-pane label="增加商品">
                    <div class="product_addNew">

                        管理
                    </div>
                </el-tab-pane>
                <el-tab-pane label="管理商品">
                    <div class="product_set">

                        管理
                    </div>
                </el-tab-pane>

                <!-- ---------------------------------------------// 商品分类--------------------->
                <el-tab-pane label="商品分类">

                    <div class="brand_list">
                        <el-tabs v-model="activeName" @tab-click="handleClick">
                            <!----------------------------------分类列表展示---------------------------->
                            <el-tab-pane label="分类列表" name="second">
                                <el-row :gutter="20">
                                    <el-col :span="2">
                                        <div class="grid-content bg-purple">类别ID</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">类别名称</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">关键字</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">操作</div>
                                    </el-col>
                                </el-row>
                                <div v-for="cate in CategroyList">
                                    <el-row :gutter="20">
                                        <el-col :span="2">
                                            <div class="grid-content bg-purple">{{cate.categroyId}}</div>
                                        </el-col>
                                        <el-col :span="6">
                                            <div class="grid-content bg-purple">{{cate.name}}</div>
                                        </el-col>
                                        <el-col :span="6">
                                            <div class="grid-content bg-purple">{{cate.keywords}}</div>
                                        </el-col>
                                        <el-col :span="6">
                                            <div class="grid-content bg-purple">
                                                <el-button type="primary" icon="el-icon-edit"
                                                           @click="Categroy(cate.categroyId)"></el-button>
                                                <el-button type="primary" icon="el-icon-delete"
                                                           @click="CategroyDelete(cate.categroyId)"></el-button>
                                            </div>
                                        </el-col>
                                        <el-dialog title="编辑分类" :modal="false"
                                                   :visible.sync="dialogFormVisible"

                                        >
                                            <el-form :model="Categroyform">
                                                <el-form-item label="分类ID" :label-width="formLabelWidth">
                                                    <el-input v-model=Categroyform.categroyId
                                                              disabled="true"></el-input>
                                                </el-form-item>
                                                <el-form-item label="分类名称" :label-width="formLabelWidth">
                                                    <el-input v-model="Categroyform.name" autocomplete="off"></el-input>
                                                </el-form-item>
                                                <el-form-item label="关键字" :label-width="formLabelWidth">
                                                    <el-input v-model="Categroyform.keywords"
                                                              autocomplete="off"></el-input>
                                                </el-form-item>

                                            </el-form>
                                            <div slot="footer" class="dialog-footer">
                                                <el-button @click="dialogFormVisible = false">取 消</el-button>
                                                <el-button type="primary" @click="CategroyUpdate()">确 定</el-button>
                                            </div>
                                        </el-dialog>
                                    </el-row>

                                </div>
                                <el-form label-width="0px" :model="Categroyform">
                                    <el-row :gutter="20">
                                        <el-col :span="3">
                                            <div class="grid-content bg-purple">
                                                <el-form-item>
                                                    <el-input placeholder="ID" v-model="Categroyform.categroyId">我的
                                                    </el-input>
                                                </el-form-item>
                                            </div>
                                        </el-col>
                                        <el-col :span="6">
                                            <div class="grid-content bg-purple">
                                                <el-form-item>
                                                    <el-input placeholder="类别名称" v-model="Categroyform.name">我的
                                                    </el-input>
                                                </el-form-item>
                                            </div>
                                        </el-col>
                                        <el-col :span="6">
                                            <div class="grid-content bg-purple">
                                                <el-form-item>
                                                    <el-input placeholder="关键字" v-model="Categroyform.keywords">我的
                                                    </el-input>
                                                </el-form-item>
                                            </div>
                                        </el-col>
                                        <el-col :span="6">
                                            <div class="grid-content bg-purple">
                                                <el-button type="primary" plain @click="CategroyInsert()">增加类别
                                                </el-button>
                                            </div>
                                        </el-col>
                                    </el-row>
                                </el-form>

                            </el-tab-pane>

                            <!----------------------------------系列列表展示---------------------------->
                            <el-tab-pane label="系列列表" name="fourth">
                                <el-row :gutter="20">
                                    <el-col :span="2">
                                        <div class="grid-content bg-purple">系列ID</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">类别标题</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">系列简介</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">操作</div>
                                    </el-col>
                                </el-row>
                                <div v-for="seri in seriesList">
                                    <el-row :gutter="20">
                                        <el-col :span="2">
                                            <div class="grid-content bg-purple">{{seri.seriesId}}</div>
                                        </el-col>
                                        <el-col :span="6">
                                            <div class="grid-content bg-purple">{{seri.seriesTitle}}</div>
                                        </el-col>
                                        <el-col :span="6">
                                            <div class="grid-content bg-purple">{{seri.seriesIntro}}</div>
                                        </el-col>
                                        <el-col :span="6">
                                            <div class="grid-content bg-purple">
                                                <el-button type="primary" icon="el-icon-edit"
                                                           @click="series(seri.seriesId)"></el-button>
                                                <el-button type="primary" icon="el-icon-delete"
                                                           @click="SeriesDelete(seri.seriesId)"></el-button>
                                            </div>
                                        </el-col>
                                        <el-dialog title="系列列表" :modal="false" :visible.sync="dialogFormVisible">
                                            <el-form :model="seriesform">
                                                <el-form-item label="系列ID" :label-width="formLabelWidth">
                                                    <el-input v-model=seriesform.seriesId disabled="true"></el-input>
                                                </el-form-item>
                                                <el-form-item label="系列名称" :label-width="formLabelWidth">
                                                    <el-input v-model="seriesform.seriesTitle"
                                                              autocomplete="off"></el-input>
                                                </el-form-item>
                                                <el-form-item label="系列简介" :label-width="formLabelWidth">
                                                    <el-input v-model="seriesform.seriesIntro"
                                                              autocomplete="off"></el-input>
                                                </el-form-item>

                                            </el-form>
                                            <div slot="footer" class="dialog-footer">
                                                <el-button @click="dialogFormVisible = false">取 消</el-button>
                                                <el-button type="primary" @click="SeriesUpdate()">确 定</el-button>
                                            </div>
                                        </el-dialog>
                                    </el-row>
                                </div>
                            </el-tab-pane>
                            <!----------------------------------系列内容展示---------------------------->
                            <el-tab-pane label="系列内容展示" name="fifth">

                                <el-row :gutter="20">
                                    <el-col :span="2">
                                        <div class="grid-content bg-purple">系列ID</div>
                                    </el-col>
                                    <el-col :span="4">
                                        <div class="grid-content bg-purple">标题</div>
                                    </el-col>
                                    <el-col :span="5">
                                        <div class="grid-content bg-purple">展示图片</div>
                                    </el-col>
                                    <el-col :span="5">
                                        <div class="grid-content bg-purple">价格</div>
                                    </el-col>
                                    <el-col :span="5">
                                        <div class="grid-content bg-purple">操作</div>
                                    </el-col>
                                </el-row>
                                <el-form label-width="0px" :model="contentform">
                                    <el-row :gutter="20">
                                        <el-col :span="3">
                                            <div class="grid-content bg-purple">
                                                <el-form-item>
                                                    <!--      数据库改为自增 删除输入框-->
                                                    <el-input placeholder="商品ID" v-model="contentform.spuId">我的
                                                    </el-input>
                                                </el-form-item>
                                            </div>
                                        </el-col>
                                        <el-col :span="3">
                                            <div class="grid-content bg-purple">
                                                <el-form-item>
                                                    <el-input placeholder="系列ID" v-model="contentform.seriesId">我的
                                                    </el-input>
                                                </el-form-item>
                                            </div>
                                        </el-col>
                                        <el-col :span="4">
                                            <div class="grid-content bg-purple">
                                                <el-form-item>
                                                    <el-input placeholder="商品标题" v-model="contentform.title">我的
                                                    </el-input>
                                                </el-form-item>
                                            </div>
                                        </el-col>
                                        <el-col :span="4">
                                            <div class="grid-content bg-purple">
                                                <el-form-item>
                                                    <el-input placeholder="图片地址" v-model="contentform.src">我的
                                                    </el-input>
                                                </el-form-item>
                                            </div>
                                        </el-col>
                                        <el-col :span="4">
                                            <div class="grid-content bg-purple">
                                                <el-form-item>
                                                    <el-input placeholder="商品价格" v-model="contentform.price">我的
                                                    </el-input>
                                                </el-form-item>
                                            </div>
                                        </el-col>



                                        <el-col :span="4">
                                            <div class="grid-content bg-purple">
                                                <el-button type="primary" plain @click="ContentInsert()">增加类别
                                                </el-button>
                                            </div>
                                        </el-col>
                                    </el-row>
                                </el-form>
                                <div v-for="seco in contentList">
                                    <el-row :gutter="20">
                                        <el-col :span="2">
                                            <div class="grid-content bg-purple">{{seco.seriesId}}</div>
                                        </el-col>
                                        <el-col :span="5">
                                            <div class="grid-content bg-purple">{{seco.title}}</div>
                                        </el-col>
                                        <el-col :span="5">
                                            <div class="grid-content bg-purple">{{seco.src}}</div>
                                        </el-col>
                                        <el-col :span="5">
                                            <div class="grid-content bg-purple">{{seco.price}}</div>
                                        </el-col>
                                        <el-col :span="5">
                                            <div class="grid-content bg-purple">
                                                <el-button type="primary" icon="el-icon-edit"
                                                           @click="content(seco.spuId)"></el-button>
                                                <el-button type="primary" icon="el-icon-delete"
                                                           @click="ContentDelete(seco.spuId)"></el-button>
                                            </div>
                                        </el-col>
                                        <el-dialog title="系列内容展示" :modal="false" :visible.sync="dialogFormVisible">
                                            <el-form :model="contentform">
                                                <el-form-item label="商品ID" :label-width="formLabelWidth">
                                                    <el-input v-model=contentform.spuId disabled="true"></el-input>
                                                </el-form-item>
                                                <el-form-item label="系列ID" :label-width="formLabelWidth">
                                                    <el-input v-model="contentform.seriesId"
                                                              autocomplete="off"></el-input>
                                                </el-form-item>
                                                <el-form-item label="标题" :label-width="formLabelWidth">
                                                    <el-input v-model="contentform.title" autocomplete="off"></el-input>
                                                </el-form-item>
                                                <el-form-item label="图片地址" :label-width="formLabelWidth">
                                                    <el-input v-model="contentform.src" autocomplete="off"></el-input>
                                                </el-form-item>
                                                <el-form-item label="价格" :label-width="formLabelWidth">
                                                    <el-input v-model="contentform.price" autocomplete="off"></el-input>
                                                </el-form-item>

                                            </el-form>
                                            <div slot="footer" class="dialog-footer">
                                                <el-button @click="dialogFormVisible = false">取 消</el-button>
                                                <el-button type="primary" @click="ContentUpdate()">确 定</el-button>
                                            </div>
                                        </el-dialog>
                                    </el-row>
                                </div>

                            </el-tab-pane>

                        </el-tabs>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="banner管理">
                    角色管理
                </el-tab-pane>
                <el-tab-pane label="管理admin用户">
                    定时任务补偿
                </el-tab-pane>
            </el-tabs>

        </el-main>


        <el-footer>
            <div id="footer" style="height: auto;">
                <div class="gmt-footer-bottom">
                    <!-- class="container" -->
                    <div style="margin-top: 10px">版权所有 ©2022 &nbsp;&nbsp;公司名：达内2203班
                        <a style="margin-left:10px;color: #000;" href="http://beian.miit.gov.cn">闽ICP备20000451号</a>
                    </div>
                </div>
            </div>
        </el-footer>
    </el-container>
    <div class="line"></div>
</div>
<!--*************************************尾部*************************-->
</div>
</body>
</html>
<script src="https://unpkg.com/vue@2.6.14/dist/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>

    let v = new Vue({
        el: "body>div",
        data: function () {
            return {
                visible: false,
                tabPosition: 'left',//导航栏靠左排列
                activeName: 'second',
                prices: [],
                activeNames: ['1'],//折叠菜单
                //增加商品分类
                formLabelAlign: {  //默认表单数据
                    name: '',
                    region: '',
                    type: ''
                },

                seriesList: "",//系列列表
                CategroyList: "", // 增加分类弹框
                contentList: "", // 系列内容列表
                // 分类列表数据
                dialogFormVisible: false,// 增加分类弹框
                Categroyform: {
                    categroyId: '',
                    name: '',
                    keywords: ''
                },
                seriesform: {
                    seriesId: '',
                    seriesTitle: '',
                    seriesIntro: ''
                },
                contentform: {
                    spuId: '',
                    seriesId: '',
                    Title: '',
                    price:'',
                    src:''
                },

                formLabelWidth: '80px'// 增加分类弹框
            }
        },
        methods: {
            handleSelect(key, keyPath) {
                console.log(key, keyPath);
            },
            handleClick(tab, event) {
                console.log(tab, event);

            },
            handleOpen(key, keyPath) {
                console.log(key, keyPath);
            },
            handleClose(key, keyPath) {
                console.log(key, keyPath);
            },
            handleSelect(key, keyPath) {
                console.log(key, keyPath);
            },
            car(id) {
                console.log("点击的是:" + id)
            },
            handleClick(tab, event) {
                console.log(tab, event);
            },//类别管理 内容导航栏
            Categroy(id) { //修改分类 弹窗
                v.dialogFormVisible = true;
                v.Categroyform.categroyId = id;
                console.log(id)
                // axios.get("/admin/Categroy/updateByid?id=" + id).then(function () {
                // })
            },
            series(id) { //修改分类 弹窗
                v.dialogFormVisible = true;
                v.seriesform.seriesId = id;
                console.log(id)
                // axios.get("/admin/Categroy/updateByid?id=" + id).then(function () {
                // })
            },
            content(id) { //修改分类 弹窗
                v.dialogFormVisible = true;
                v.contentform.spuId = id;
                console.log(id)
                // axios.get("/admin/Categroy/updateByid?id=" + id).then(function () {
                // })
            },
            SeriesUpdate() {
                axios.post("/admin/Categroy/Seriesupdate", v.seriesform).then(function (response) {
                    console.log("seriesform=" + v.seriesform)
                    if (response.data == 1) {
                        alert("修改完成")
                        location.reload()
                    }
                })
                v.dialogFormVisible = false;
            },
            CategroyUpdate() {
                axios.post("/admin/Categroy/update", v.Categroyform).then(function (response) {
                    console.log("categroyForm=" + v.Categroyform)
                    if (response.data == 1) {
                        alert("修改完成")
                        location.reload()
                    }
                })
                v.dialogFormVisible = false;
            },
            ContentUpdate() {
                axios.post("/admin/Categroy/ContentUpdate", v.contentform).then(function (response) {
                    console.log("categroyForm=" + v.contentform)
                    if (response.data == 1) {
                        alert("修改完成")
                        location.reload()
                    }
                })
                v.dialogFormVisible = false;
            },
            CategroyInsert() {
                alert("增加")
                axios.post("/admin/Categroy/addNew", v.Categroyform).then(function () {
                    console.log("categroyForm=")
                    alert("增加成功")
                    location.reload();
                })
            },

            ContentInsert() {
                alert("增加")
                axios.post("/admin/Categroy/contentAddNew", v.contentform).then(function () {
                    console.log("contentform={}",v.contentform)
                    alert("增加成功")
                    location.reload();
                })
            },
            SeriesDelete(id) {
                this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                    center: true
                }).then(() => {
                    console.log("id=" + id)
                    axios.get("/admin/Categroy/seriesDeleteByid?id=" + id).then(function (response) {
                        console.log("id=" + id)
                        console.log("删除成功")
                        if (response.data == 1) {
                            alert("删除完成")
                            location.reload()
                        } else {
                            alert("出现错误")
                        }
                    })
                    console.log("成功")

                }).catch(() => {

                });
            },
            ContentDelete(id) {
                this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                    center: true
                }).then(() => {
                    console.log("id=" + id)
                    axios.get("/admin/Categroy/contentDeleteByid?id=" + id).then(function (response) {
                        console.log("id=" + id)
                        console.log("删除成功")
                        if (response.data == 1) {
                            alert("删除完成")
                            location.reload()
                        } else {
                            alert("出现错误")
                        }
                    })
                    console.log("成功")

                }).catch(() => {

                });
            },
            CategroyDelete(id) {
                this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                    center: true
                }).then(() => {
                    console.log("id=" + id)
                    axios.get("/admin/Categroy/deleteByid?id=" + id).then(function (response) {
                        console.log("id=" + id)
                        console.log("删除成功")
                        if (response.data == 1) {
                            alert("删除完成")
                            location.reload()
                        } else {
                            alert("出现错误")
                        }
                    })
                    console.log("成功")

                }).catch(() => {

                });
            }

        },


        created: function () {
            axios.get("/admin/Categroy/list").then(function (response) {
                console.log(response.data)
                v.CategroyList = response.data;
                console.log("bababaababababbaab")
            })
                axios.get("/admin/Categroy/seriesList").then(function (response) {
                    console.log(response.data)
                    v.seriesList = response.data;
                    console.log("aaaaaaa")
                })
                axios.get("/admin/Categroy/contentList").then(function (response) {
                    console.log(response.data)
                    v.contentList = response.data;
                    console.log("aaaaaaa")
                })
        }


    })


</script>
